package com.aistar.order.service.impl;

import com.aistar.order.entity.OrderInfo;
import com.aistar.order.mapper.OrderInfoMapper;
import com.aistar.order.service.IOrderInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created by Administrator on 2019/6/25 0025.
 */
@Service
@Transactional
public class OrderInfoImpl implements IOrderInfoService {
    @Autowired
    private  OrderInfoMapper orderInfoMapper;

    @Override
    public List<OrderInfo> findAll(String id) {
        return orderInfoMapper.findAll(id);
    }

    @Override
    public OrderInfo findById(String Id) {
        return orderInfoMapper.findById(Id);
    }

    @Override
    public boolean save(OrderInfo orderInfo) {
     OrderInfo o  =  orderInfoMapper.findByIdCard(orderInfo.getIdCard());
        if(o==null){
             orderInfoMapper.save(orderInfo);
            return true;
        }
        return false;
    }

    @Override
    public void delete(String id) {
        orderInfoMapper.delete(id);
    }

    @Override
    public void update(OrderInfo orderinfo) {
        orderInfoMapper.update(orderinfo);
    }
}
